
<template>
  <div class="app-container home">
    研究项目名称<el-input v-model="inputSearch" placeholder="请输入内容" class="inRes" style="margin-right: 10px"></el-input>
    <el-button type="primary" @click="searchTitle()">查询</el-button>
    <el-button type="success" @click="refresh()">刷新</el-button>
    <el-row :gutter="24" style="margin-top: 16px">
      <el-col :span="8" v-for="r in researchList" >
        <el-card shadow="hover">
          <div style="font-weight: bold;font-size: 12px;height: 40px;">{{r.sname}}</div>
          <div class="cardList">受试者筛选共: {{r.countTester}}人</div>
          <div class="container">
            <div class="cardList2">完成入组受试者: {{r.countGroup}} 人</div>
            <div class="cardList2">完成提交受试者: {{r.countCrf}} 人</div>
          </div>
          <el-divider></el-divider>
          <center>
            <el-button type="primary" size="mini" plain @click="crfTrans()">CRF模板</el-button>
            <el-button type="primary" size="mini" plain style="margin-left: 10%" @click="researchTrans(r.id)">受试者管理</el-button>
          </center>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {listAll, listResearch, selectBySname} from "@/api/system/research";


export default {
  data() {
    return {
      inputSearch: '',
      researchList:[
      ],
      researchArr:[]
    }
  },

  mounted() {
    // console.log(this.$store.state.user.hospId)
  },
  created() {
    listResearch().then(res=>{
      this.researchList = res;
      console.log(this.researchList)
    })
  },
  methods:{
    refresh(){
      listResearch().then(res=>{
        this.researchList = res;
        console.log(this.researchList)
      })
    },
    researchTrans(id){
      this.$router.push('/subject?id=' + id)
    },
    crfTrans(){
      this.$router.push('/CRF')
    },
    searchTitle(){
      selectBySname(this.inputSearch).then(res=>{
        this.researchList = res;
        console.log(this.researchList)
      })
    }
  }
}
</script>

<style scoped>
.inRes{
  width: 30%;
  margin-left: 10px;
}
.cardList{
  font-size: 12px;
  margin-top: 12px;
}
.container{
  display: flex;
}
.cardList2{
  font-size: 12px;
  margin-top: 12px;
  flex: 1;
}
</style>
